﻿@model mscook.mvc.Models.CommentModel

<div class="comment clearfix">
    <div class="row">
        <div class="span8">
            <form id="commentForm" action="@Url.Action("comment", "comment")" method="post">
                <input type="hidden" id="ResourceId" name="ResourceId" value="@Model.ResourceId" />
                <input type="hidden" id="ReturnUrl" name="ReturnUrl" value="@Model.ReturnUrl" />
                 <input type="hidden" id="parentComment" name="parentComment" />
                <input type="hidden" id="toLoginUser" name="toLoginUser" />
                <div class="span1 uhead">
                    <div class="head_img">
                        <img src="~/Images/head.jpg" />
                    </div>
                </div>
                <div class="span6">
                    <textarea name="content" id="content" rows="6" class="span6"></textarea>
                </div>
                <div class="span7 clearfix">

                    <a href="#" class="toComment comment_btn btn">
                        评论
                    </a>
                </div>
            </form>
        </div>
        <div class="span8 comment_detail clearfix">
            <ul id="commentul">
                @if (Model != null)
                {
                    for (int i = 0; i < Model.Comments.Count; i++)
                    {
                        var comment = Model.Comments.ElementAt(i);
                    <li class="clearfix">
                        <div class="span1 uhead">
                            <div class="head_img">
                                <img src="~/Images/head.jpg" />
                            </div>
                            <p class="uname"><a href="#">@Html.Encode(comment.FormLoginUser.LoginName)</a></p>
                        </div>
                        <div class="span6">
                            <p>@Html.Encode(comment.Content)</p>
                            <p>
                                <span class="time">@Html.Encode((comment.ToLoginUser==null?"":("回复:"+comment.ToLoginUser.LoginName+"  "))+comment.CreateTime.ToString())</span>
                                <a href="javascript:void(0); " class="reply_btn"  data-link-reply="@Html.Encode("replydiv"+i)">回复</a><a href="javascript:void(0); "  data-link-reply="@Html.Encode("replydiv"+i)" class="reply_hide">收起</a>
                            </p>
                            <div class="span6 reply" id="@Html.Encode("replydiv"+i)">
                                <div class="span6">
                                    <input type="hidden" value="@comment.FormLoginUser.LoginName" />
                                    <textarea id="@Html.Encode("reply"+i)" rows="6" class="span5"></textarea>
                                </div>
                                <div class="span5 clearfix">
                                    <a href="javascript:void(0);" data-parentcomment="@Html.Encode(comment.Id)" data-link-content="@Html.Encode("reply"+i)" data-tologinuser="@Html.Encode(comment.FormLoginUser.LoginName)" class="replyComment comment_btn btn">回复</a>
                                </div>
                            </div>
                        </div>

                    </li>
                            
                    }
                }
            </ul>
            <div class="pagination">
                <ul>
                    <li><a id="commentMore" href="javascript:void(0);" data-index="2">加载更多</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
